<?php

class UpdateRecordScript extends ScriptBlock
{

	function __construct ()
	{
	$html =  "<script language = \"javascript\">\n";
	$html .= "function updateRecord(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"UpdateRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
//	$html .= "document.getElementById(\"PrimaryField\").value = PrimaryField;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function insertRecord(ID, DBTableName)\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"InsertRecord\";\n";
	$html .= "document.getElementById(\"RecordID\").value = ID;\n";
//	$html .= "document.getElementById(\"PrimaryField\").value = PrimaryField;\n";
	$html .= "document.getElementById(\"DBTableName\").value = DBTableName;\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "function cancel()\n";
	$html .= "{\n";
	$html .= "if(document.getElementById(\"CallingPage\"))\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = document.getElementById(\"CallingPage\").value;\n";
	$html .= "}\n";
	$html .= "else\n";
	$html .= "{\n";
	$html .= "document.getElementById(\"Action\").value = \"ListEvents\";\n";
	$html .= "}\n";
	$html .= "document.getElementById(\"PageForm\").submit();\n";
	$html .= "}\n";
	$html .= "</script>\n";
	$this->scriptHTML = $html;
	}
}